package tp6;

public class MyBag<T> implements Bag<T> {

	private SimpleMap<T,Integer> table;
	
	public MyBag(int initialSize){
		table=new LinearProbingTable<T,Integer>(initialSize,0.5);
	}
	
	@Override
	public void add(T value) {
		Integer aux=table.get(value);
		if(aux!=null){
			table.put(value,aux+1);
			return;
		}
		table.put(value,0);
	}

	@Override
	public int occurencesOf(T value) {
		Integer aux=table.get(value);
		
		if(aux==null){
			return 0;
		}
		return aux;
	}

	@Override
	public void remove(T value) {
		table.remove(value);
	}

}
